package com.vr.caricature.tuijian;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;

import com.vr.caricature.R;
import com.vr.caricature.fenlei.VideoAdapter;
import com.vr.caricature.main.MainActivity;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by chengxiaozhi on 2016/11/2.
 */

public class TuijianFragment extends Fragment{

    @InjectView(R.id.gv_video)
    VideoGridView gvVideo;
    @InjectView(R.id.scrollview)ScrollView scrollView;
    private VideoAdapter mVAdapter;

    public MainActivity mainActivity;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mainActivity = (MainActivity) getActivity();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fg_tuijian,container,false);
        ButterKnife.inject(this,view);
        mVAdapter = new VideoAdapter(mainActivity);
        gvVideo.setAdapter(mVAdapter);
        gvVideo.setFocusable(false);
        scrollView.scrollTo(0,20);
        return view;
    }

    @OnClick(R.id.ll_jp_cture)
    public void riman(){
        mainActivity.setItemSelect(0);
    }

    @OnClick(R.id.ll_cn_cture)
    public void guoman(){mainActivity.setItemSelect(1);}

    @OnClick(R.id.ll_dp_cture)
    public void bendi(){
        mainActivity.setItemSelect(2);
    }

    @OnClick(R.id.ll_yc_cture)
    public void yuanchuang(){
        mainActivity.setItemSelect(3);
    }

    @OnClick(R.id.ll_qt_cture)
    public void qita(){
        mainActivity.setItemSelect(4);
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }
}
